<template>
  <div>
    <childer :data="data" @data="datalist" ref="aaa"></childer>
    <div>{{ msg }}</div>
    <div>1111111</div>
    <div v-for="item in data" :key="item">
      {{ item }}
    </div>
    <button @click="btn">点击</button>
  </div>
</template>
<script>
import Childer from "./Childer.vue";
export default {
  data() {
    return {
      msg: "",
      data: [1, 2, 3, 4, 5, 6],
    };
  },
  components: {
    Childer,
  },
  mounted() {
    this.$refs.aaa.click();
  },
  methods: {
    datalist(data) {
      this.msg = data;
      // console.log(data ,111111222);
    },
    btn() {
      this.$forceUpdate();
      // this.$router.push({path:'/Fater2',query:{data:this.data}})
      // this.$router.push({name:'Fater2',params:{data:this.data}})
      // this.data[0] = 111
      // this.data.push(1);
      // this.data.pop()
      // this.$set(this.data, 0, 1111)
      console.log(this.data);
    },
  },
  created() {
    // console.log(1111);
    // console.log(this.data instanceof Array ,111)
    // console.log(this.data.con);
    //  foo(10);
    // function foo(num){
    //     console.log('foo:',foo);
    //     var foo = num;
    //     console.log('foo:',foo);
    //     console.log('111', 1&2);
    //     console.log('111', 1&3);
    //     console.log('111', 2&3);
    //     let x = [1,2,3,4,5] [0..toString.length];
    //     console.log(x);
    // }
    var p1 = new Promise((resolve) => {
      console.log(1);
      resolve({
          name:'1111'
      });
    });
    var p2 = new Promise((resolve) => {
      setTimeout(() => {
        console.log(2,resolve);
        resolve();
      }, 1000);
    });
    var p3 = new Promise((resolve) => {
      setTimeout(() => {
        console.log(3);
        resolve();
      }, 1000);
    });

    Promise.all([p1, p2, p3]).then((result) => {
      console.log("执行完毕", result);
    });
  },
  watch: {
    data() {
      console.log(1111223344);
    },
  },
};
</script>
<style lang="scss" scoped>
</style>